package com.example.demo.test.leetcode.day1123;

import java.util.Arrays;
import java.util.LinkedList;

public class Solution {
    public static void main(String[] args) {
        ListNode listNode = new ListNode(1);
        ListNode listNode1 = new ListNode(2, listNode);
        LinkedList<Integer> link = new LinkedList<>();
        link.add(1);
        link.add(2);
        
    }

    public static void deleteNode(ListNode node) {

    }

    public int findMinArrowShots(int[][] points) {
        if (points == null || points.length <= 0) {
            return 0;
        }

        int result = 1;
        Arrays.sort(points, (point1, point2) -> {
            if (point1[1] > point2[1]) {
                return 1;
            } else if (point1[1] < point2[1]) {
                return -1;
            } else {
                return 0;
            }
        }); // 根据 开始位置，从小到大 排序原数组

        /*
            贪心，遍历数组，计算结果
         */
        int curEnd = points[0][1];
        for (int i = 0; i < points.length; i++) {
            if (points[i][0] > curEnd) {
                result++;
                curEnd = points[i][1];
            }
        }

        return result;
    }

    public static ListNode removeNthFromEnd(ListNode head, int n) {
        if(head==null||head.next==null){
            return null;
        }
        return null;
    }
}
